package com.mao.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MakeOrderNo {
	// QX100731000008
	public static String getOrderNo(Long storeid, String type,Integer usedqty) {
		long No = 0;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		String nowdate = sdf.format(new Date());
		No = Long.parseLong(nowdate); // * 1000;//这里假如一天订单多的话可以用一万或更大
		String getNo = "";
		if (String.valueOf(usedqty + 1).length() == 1) {
			getNo = "000" + String.valueOf(usedqty + 1);
		}
		if (String.valueOf(usedqty + 1).length() == 2) {
			getNo = "00" + String.valueOf(usedqty + 1);
		}
		if (String.valueOf(usedqty + 1).length() == 3) {
			getNo = "0" + String.valueOf(usedqty + 1);
		}
		if (String.valueOf(usedqty + 1).length() == 4) {
			getNo = String.valueOf(usedqty + 1);
		}
		String getOrder = type + storeid + No + getNo;
		return getOrder;
	}
	
	public static void main(String[] args) {
//		System.out.println(getOrderNo(1,100));
	}
}
